< previous page page_519 next page >

Page 519
e10a6a0a59f035e870d90cca05b85fce.gif
        zoff2 = PathPoints(i).coord(3) - _
            PathPoints(1) .coord(3)

        For j = 1 To NumCurvePts
            ThePolyline.AddSegment _
                CurvePoints(j).coord(1) + xoff1, _
                CurvePoints(j).coord(2) + yoff1, _
                CurvePoints(j).coord(3) + zoff1, _
                CurvePoints(j).coord(1) + xoff2, _
                CurvePoints(j).coord(2) + yoff2, _
                CurvePoints(j).coord(3) + zoff2
        Next j
        xoff1 = xoff2
        yoff1 = yoff2
        zoff1 = zoff2
    Next i
End Sub
Most of the rest of the Extrusion3d routines pass requests to the points that make up the curve and path or to the display polyline if it exists. For instance, the following code shows the ApplyFull routine, which applies a transformation matrix to the object.
e10a6a0a59f035e870d90cca05b85fce.gif
' Apply a transformation matrix which may not
' contain 0, 0, 0, 1 in the last column to the object.
Public Sub ApplyFull(M() As Single)
Dim i As Integer

    ' Transform the base curve.
     For i = 1 To NumCurvePts
         m3ApplyFull CurvePoints(i).coord, M, _
                     CurvePoints(i).trans
     Next i

     ' Transform the generating path.
     For i = 1 To NumPathPts
         m3ApplyFull PathPoints(i).coord, M, _
                     PathPoints(i).trans
     Next i

    ' Transform the display polyline if it exists.
    If Not (ThePolyline Is Nothing) Then _
        ThePolyline.ApplyFull M
End Sub
Example program Extrude, shown in Figure 14.33, demonstrates the Extrusion3d class. Use the option buttons to pick a base curve and a generating path. Then click the Extrude button to see the resulting surface. Use the arrow keys to change the viewing direction.

 
< previous page page_519 next page >